package com.pattern.flyweight_pattern;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author chen
 * @date 2018/3/26
 * <p>
 * Email 122741482@qq.com
 * <p>
 * Describe:
 */
public class FlyWeightPatternDemo {

    public static void main(String[] args){
        List<String> name=new ArrayList<String>();
        name.add("红色");
        name.add("黄色");
        name.add("蓝色");
        name.add("紫色");
        name.add("红色");
        name.add("绿色");


        for (String n :name){
            Color color=   ColorFactory.getColor(n);
            color.print();
        }



    }

}
